package 每日一题;

/**
 * @author 会玩的洋洋
 * https://leetcode-cn.com/problems/1-bit-and-2-bit-characters/
 */
public class _717_1比特与2比特字符 {
    public boolean isOneBitCharacter(int[] bits) {
        int n = bits.length - 1;
        int index = 0;
        while (index < n) {
            if (bits[index] == 0) {
                index++;
            } else {
                index += 2;
            }
        }
        return index == n;
    }
}
